package entity;

import java.util.List;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.ForceDiscriminator;

@Entity
@DiscriminatorValue("process")
@ForceDiscriminator
public class Process extends Activity{
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy="process")
	@Cascade({CascadeType.ALL, CascadeType.DELETE_ORPHAN})
	private List<Activity> activities;
	
	@ManyToMany(fetch=FetchType.LAZY)
	@JoinTable(name="Action_Process", joinColumns=@JoinColumn(name="Process_id"), 
			   inverseJoinColumns=@JoinColumn(name="Action_id"))
	@Cascade({CascadeType.ALL})
	private List<StrategicAction> actions;

	public void setActivities(List<Activity> activities) {
		this.activities = activities;
	}

	public List<Activity> getActivities() {
		return activities;
	}

	public void setActions(List<StrategicAction> actions) {
		this.actions = actions;
	}

	public List<StrategicAction> getActions() {
		return actions;
	}
	
}
